package com.example.administrator.myapplication.fragmentlei;

import android.app.Activity;
import android.app.Fragment;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;
import android.widget.TextView;

import com.example.administrator.myapplication.Didian;
import com.example.administrator.myapplication.R;
import com.example.administrator.myapplication.ZhuJianMian;

/**
 * Created by Administrator on 2017/1/4.
 */
public class Fragment1 extends Fragment {
    TextView tv_didi;
    String init;
    ListView lv_cy;
    ListView lv_xinxi;
    ListView lv_lx;
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.zhu_fragment,container,false);
        return view;
    }

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        ZhuJianMian activity = (ZhuJianMian) getActivity();
         init = activity.init();
        initdat();
        tv_didi = (TextView) getActivity().findViewById(R.id.tv_didi);
        huoqu();
        tv_didi.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(getActivity(), Didian.class);
                startActivity(intent);
            }
        });

    }

    private void initdat() {
        lv_cy = (ListView) getActivity().findViewById(R.id.lv_cy);
        lv_xinxi = (ListView) getActivity().findViewById(R.id.lv_xinxi);
        lv_lx = (ListView) getActivity().findViewById(R.id.lv_lx);
    }

    private void huoqu() {


        if (init != null){
            tv_didi.setText(init);
        }else {
            tv_didi.setText("贵阳");
        }

    }

}
